import { PureComponent } from "react"
import { isNull } from "../utils/helper"
import { Icon } from 'antd-mobile';
class MIcon extends PureComponent {
	constructor(props) {
		super(props);
		this.state = {

		}
	}
	render() {
		let { type, style, className, size, color,isAntd } = this.props;
		if (isNull(type)) {
			return null
		}
		if(isAntd){
			return <Icon {...this.props}></Icon>
		}
		if (type.indexOf("&#") == 0) {
			let html = "<i class='iconfont' style='font-size:" + size + "px;color:" + color + "'>" + type + "</i>";
			return (
				<div style={style} dangerouslySetInnerHTML={{ __html: html }}>
				</div>
			)
		}
		let iconClass = "iconfont icon-" + type;
		if (!isNull(className)) {
			iconClass += " " + className
		}
		return (
			<i className={iconClass} style={style} />
		)
	}
}
export default MIcon;
export { MIcon };